package com.demo.network.nio;

public class Server {
    private static int DEFAULT_PORT = 9096;
    private static ServerHandle serverHandler;


    public static void start() {
        start(DEFAULT_PORT);
    }

    public static synchronized void start(int port) {
        if (serverHandler != null) {
            serverHandler.stop();
        }
        serverHandler = new ServerHandle(port);
        new Thread(serverHandler, "Server").start();
    }


}
